package org.rednebula.framework.core.model.domain;

import org.hibernate.Query;
import org.hibernate.Session;
import org.rednebula.framework.core.IEnvironment;
import org.rednebula.framework.core.service.ServiceFacade;

public class HibernateQuery extends AbstractQuery {

	@Override
	protected void applyPage(Object query) {

	}

	public Object execute(IEnvironment env) {

		Session session = ServiceFacade.getHibernateDbService(env).getSession();
		Query query = session.createQuery(hql());
		applyParameters(query);
		applyPage(query);
		return uniqueResult == true ? query.uniqueResult() : query.list();
	}

	@Override
	protected void applyParameters(Object query) {

	}

	@Override
	public String hql() {
		return null;
	}

}
